<div class="text-left col-left form-horizontal event-item clearfix box">

<?php $form=$this->beginWidget('CActiveForm', array(
    'id'=>'info-Members-form',
    'enableClientValidation'=>false,
    'clientOptions' => array(
                'validateOnSubmit' => true,
            ),
    
)); ?>
 <aside class="use-tit event-item clearfix ">
    <h2>Thay đổi thông tin cá nhân</h2>
</aside>
    <div class="form-group">
        <label for="inputEmail3" class="col-sm-3 control-label">Tên</label>
        <div class="col-sm-8"> 
        <?php echo $form->textField($model,'lname',array('class'=>'form-control')); ?>
        <?php echo $form->error($model,'lname'); ?>
        </div>
    </div>

    <div class="form-group">
        <label for="inputEmail3" class="col-sm-3 control-label">Họ</label>
        <div class="col-sm-8">  
        <?php echo $form->textField($model,'fname',array('class'=>'form-control')); ?>
        <?php echo $form->error($model,'fname',array('class'=>'use-info-error')); ?>
        </div>
    </div>

    <div class="form-group">
        <label for="inputEmail3" class="col-sm-3 control-label">Giới tính</label>
        <div class="col-sm-4">  
        <?php echo $form->dropDownList($model,'gender',array('1'=>'Nam','2'=>'Nữ'),array('prompt'=>'Chọn giới tính','class'=>'form-control')); ?>
        <?php echo $form->error($model,'gender'); ?>
        </div>
    </div>

    <div class="form-group">
        <label for="inputEmail3" class="col-sm-3 control-label">Ngày sinh</label>
        <div class="col-sm-4">   

        <?php $this->widget('zii.widgets.jui.CJuiDatePicker',
              array(
                'name'=>'Members[dateofbirth]',
                'language' => 'vi',
                'value'=>$model->dateofbirth,
                'options'=>array(
                      'showAnim'=>'fold',
                      'minDate'=>'new Date()',
                      'dateFormat' => "dd-mm-yy",
                      'yearRange' => "0:+1",
                ),
                'htmlOptions'=>array(
                  'class'=>'form-control',
                ),
              )
      );?>
        <?php echo $form->error($model,'dateofbirth'); ?>
        </div>
    </div>

    <div class="row buttons">
        <?php echo CHtml::Button('Thay đổi',array('class'=>"btn btn-primary",'id'=>'use-cha-acc','style'=>"margin-left: 170px;")); ?>
    </div>

<?php $this->endWidget(); ?>

</div><!-- form -->
<script type="text/javascript">
    $('#use-cha-acc').click(function() {
        $.ajax({
                  type: "POST",
                  dataType:'json',
                  url: "<?php echo Yii::app()->createUrl('/Users/profiles/info');?>",
                  data:$("#info-Members-form").serialize(),
                  beforeSend:function(data) {
                  },  
                  success: function(data){
                    if (data.status == "success") {
                        $('#usr-name').html(data.name);
                        $('#usr-gender').html(data.gender);
                        $('#usr-dateofbirth').html(data.date);
                        $('#use-change-acc').slideToggle();
                    }else if (data.status == "empty") {
                        console.log(data);
                        $('#use-info-error').html(data.error);
                    };
                  },
          });
    });
</script>